package servlets;

import javax.servlet.*;
import java.io.IOException;

public class ThirdServlet implements Servlet {

    private ServletConfig config;

    @Override
    public void init(ServletConfig servletConfig) throws ServletException {
        this.config = servletConfig;
    }

    @Override
    public ServletConfig getServletConfig() {
        return config;
    }

    @Override
    public void service(ServletRequest servletRequest, ServletResponse servletResponse) throws ServletException, IOException {

        ServletContext context = config.getServletContext();


        String mobile = (String) context.getAttribute("mobile");
        String email = (String) context.getAttribute("email");

        System.out.println("mobile = " + mobile);
        System.out.println("email = " + email);

        String contextPath = context.getContextPath();
        System.out.println("contextPath = "+contextPath);


        String realPath = context.getRealPath("/images");

        System.out.println("realPath = "+ realPath);

    }

    @Override
    public String getServletInfo() {
        return null;
    }

    @Override
    public void destroy() {

    }
}
